package server

import (
	"github.com/gin-gonic/gin"
	"restful-go/internal/auth"
	"restful-go/internal/controller"
)

func RegisterRoute() *gin.Engine {
	route := gin.Default()
	route.GET("/ping", controller.Ping)
	route.GET("/api/info", auth.AuthMiddleware(), controller.GetUser)
	route.POST("/api/login", controller.Login)
	route.POST("/api/upload", controller.Upload)
	route.POST("/api/goods", controller.CreateGoods)
	route.GET("/api/goods", controller.GetGoods)
	route.GET("/api/goods/:id", controller.GetGoodsInfo)
	route.PUT("/api/goods/:id", controller.EditGoods)
	route.PUT("/api/inventory/:id", controller.ChangeInventory)
	return route
}
